/*
 * Copyright (c) 2011-2014, fortiss GmbH.
 * Licensed under the Apache License, Version 2.0.
 *
 * Use, modification and distribution are subject to the terms specified
 * in the accompanying license file LICENSE.txt located at the root directory
 * of this software distribution. A copy is available at
 * http://chromosome.fortiss.org/.
 *
 * This file is part of CHROMOSOME.
 *
 * $Id: marshaler.h 6327 2014-01-14 18:18:48Z gulati $
 */

/**
 * \file
 *
 * \brief  Waypoint that marshals topic data for network transportation.
 *
 *         This file has been generated by the CHROMOSOME Modeling Tool (XMT)
 *         (fortiss GmbH).
 */

#ifndef XME_WP_MARSHAL_MARSHALERGEN_H
#define XME_WP_MARSHAL_MARSHALERGEN_H

/**
 * \addtogroup wp_marshal
 * @{
 */

/******************************************************************************/
/***   Includes                                                             ***/
/******************************************************************************/
#include "xme/core/component.h"
#include "xme/core/dataManagerTypes.h"

#include "xme/wp/waypoint.h"

#include <stdbool.h>
#include <stdint.h>

/******************************************************************************/
/***   Prototypes                                                           ***/
/******************************************************************************/
XME_EXTERN_C_BEGIN

/**
 * \brief  Execute this waypoint.
 *
 * \details Before calling this, you must once add a configuration for the given instanceId, via
 *          xme_wp_demarshaler_addConfig.
 *          Executing this function will get the topic data from the inputPort of the associated
 *          configuration and marshal the data. The result will be written to the output port of
 *          the associated configuration.
 *
 * \param  instanceId Id of the configuration for which to execute the waypoint, as returned by
 *                    xme_wp_demarshaler_addConfig.
 *
 * \retval XME_STATUS_SUCCESS if the marshaling was performed successfully.
 * \retval XME_STATUS_INVALID_HANDLE if no configuration has been added for the given
 *         instanceId.
 * \retval XME_STATUS_INTERNAL_ERROR if there was an error reading from the input port
 *         or writing to the output port. When this value is returned the output port value
 *         must be considered invalid.
 */
xme_status_t
xme_wp_marshal_marshaler_run
(
    xme_wp_waypoint_instanceId_t instanceId
);

/**
 * \brief  Checks whether a given topic can be handled by this marshaler.
 *
 * \param  topic Topic to check.
 *
 * \return True when the given topic can be handled by this marshaler, else false.
 */
bool
xme_wp_marshal_marshaler_isSupported
(
    xme_core_topic_t topic
);

XME_EXTERN_C_END

/**@}*/

#endif // #ifndef XME_WP_MARSHAL_MARSHALERGEN_H
